package com.clown.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.clown.core.JedisClusterUtils;

/**
 * 登陆测试
 * 
 * @author CJ
 * @since 2017年9月13日
 * @version 1.0
 */
@RestController
@RequestMapping("/login")
public class TestController {
	
	
	/**
	 * 登陆
	 * 
	 * @param request
	 * @param response
	 * @return
	 * @author CJ
	 * @since 2017年9月13日
	 */
	@RequestMapping("/hello")
	public ModelMap toHello(HttpServletRequest request, HttpServletResponse response){
		ModelMap model = new ModelMap();
		JedisClusterUtils.saveString("cityKey", "北京");
		String cityName = JedisClusterUtils.getString("cityKey");
		model.addAttribute("xxxxxxxx", "fffffff");
		model.addAttribute("cityName", cityName);
		Object userPo = JedisClusterUtils.hashGet("clown:userInfoById:", "1");
		model.addAttribute("userPo", userPo);
		return model;
	}
	
	/**
	 * 测试页面
	 * 
	 * @param request
	 * @param response
	 * @return
	 * @author CJ
	 * @since 2017年9月19日
	 */
	@RequestMapping("/index")
	public ModelAndView toMain(HttpServletRequest request, HttpServletResponse response){
		ModelAndView view = new ModelAndView();
		view.setViewName("index");
		return view;
	}

}
